#include("common.html")
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>商城</title>
    
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/css/vant.css">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/css/filter.css">
	<link rel="stylesheet" type="text/css" href="#(tpath)/static/toast/animate.css">
	<link rel="stylesheet" type="text/css" href="#(tpath)/static/toast/toast.css">
    <script type="text/javascript" src="#(tpath)/static/js/jquery.js"></script>
    <script type="text/javascript" src="#(tpath)/static/toast/toast.js"></script>
  </head>
  
  <body class="">
    <style type="text/css">@media only screen and (min-width: 320px){ html { font-size: 62.5% !important; } } @media only screen and (min-width: 640px){ html { font-size: 125% !important; } } @media only screen and (min-width: 750px){ html { font-size: 150% !important; } } @media only screen and (min-width: 1242px){ html { font-size: 187.5% !important; } }</style>
    <!-- 样式 -->
    <style>.container { background: #f8f8f8; overflow: hidden; height: 100%; box-sizing: border-box; font-size: 14px; color: #666; position: relative; } .van-cell-group { background-color: #fff; } [class*=van-hairline]::after{ border: none; } .van-cell { padding: 20px 15px; } .van-field .van-cell__title{max-width: 75px;} .submitBox{margin:20px 0px;} .van-radio-group{height:40px} .van-radio { float: left; margin-right: 10px; color: #666; height: 40px; } .van-radio__label{ font-size:12px; margin-left: 5px; } .back-bt{ margin-top: 10px; } #errorTip{height: 22px;} .copyright-content{ position: fixed; bottom: 30px; width: 100%; text-align: center; font-size: 12px; color: #999; }</style>
    <!-- 内容 -->
    <div id="set_account" class="container">
      <div class="small_block_title">
        <h1>设置收款账户</h1></div>
      <div class="small_block_content">
        <div class="van-cell van-cell--center van-cell--required van-field">
          <div class="van-cell__title">
            <span>验证码</span></div>
          <div class="van-cell__value">
            <div class="van-field__body">
              <input type="text" placeholder="输入图形验证码" class="van-field__control" id="captcha">
                <img width="80" src="#(base)/common/captcha/image" onclick="this.src='#(base)/common/captcha/image?'+Math.round(Math.random()*10);" class="captcha"></div>
          </div>
        </div>
        <div class="van-cell-group van-hairline--top-bottom">
          <div class="van-cell van-cell--center van-field">
            <!---->
            <div class="van-cell__title">
              <span>短信验证码</span>
              <!----></div>
            <div class="van-cell__value">
              <div class="van-field__body">
                <input type="text" placeholder="请输入短信验证码" class="van-field__control" id="code">
                <!---->
                <!---->
                <div class="van-field__button">
                  <button class="van-button van-button--primary van-button--small" id="sendCaptchaBtn" onclick="getVerify()">
                    <span class="van-button__text" id="getCode">发送验证码</span></button>
                </div>
              </div>
              <!----></div>
            <!----></div>
        </div>
        <div class="van-cell-group van-hairline--top-bottom" id="payCheck">
          <div class="van-radio-group">
            <div class="van-radio" style="padding: 10px;" id="wechatCheck">
              <span class="van-radio__input">
                <input type="radio" class="van-radio__control" value="wechat">
                <i class="van-icon van-icon-checked" style="color: rgb(7, 193, 96);" id="wechatRadio" val="Wechat">
                  <!---->
                  <!----></i>
              </span>
              <span class="van-radio__label">微信</span></div>
            <div class="van-radio" style="padding: 10px;" id="alipayCheck">
              <span class="van-radio__input">
                <input type="radio" class="van-radio__control" value="alipay">
                <i class="van-icon van-icon-circle" style="color: rgb(7, 193, 96);" id="alipayRadio" val="Alipay">
                  <!---->
                  <!----></i>
              </span>
              <span class="van-radio__label">支付宝</span></div>
            <div class="van-radio" style="padding: 10px;" id="bankCheck">
              <span class="van-radio__input">
                <input type="radio" class="van-radio__control" value="bank">
                <i class="van-icon van-icon-circle" style="color: rgb(7, 193, 96);" id="bankRadio" val="Bank">
                  <!---->
                  <!----></i>
              </span>
              <span class="van-radio__label">银行卡</span></div>
          </div>
        </div>
        <div class="van-cell-group van-hairline--top-bottom" style="display: none;" id="bankDiv">
          <div class="van-cell van-cell--center van-cell--required van-field">
            <!---->
            <div class="van-cell__title">
              <span>银行名称</span>
              <!----></div>
            <div class="van-cell__value">
              <div class="van-field__body">
                <input type="text" placeholder="在此处输入银行名称" class="van-field__control" id="inputBank">
                <!---->
                <!---->
                <!----></div>
              <!----></div>
            <!----></div>
        </div>
        <div class="van-cell-group van-hairline--top-bottom">
          <div class="van-cell van-cell--center van-cell--required van-field">
            <!---->
            <div class="van-cell__title">
              <span>设置账户</span>
              <!----></div>
            <div class="van-cell__value">
              <div class="van-field__body">
                <input type="text" placeholder="在此处输入账户" class="van-field__control" id="inputAccount">
                <!---->
                <!---->
                <!----></div>
              <!----></div>
            <!----></div>
        </div>
        <div class="van-cell-group van-hairline--top-bottom">
          <div class="van-cell van-cell--center van-cell--required van-field">
            <!---->
            <div class="van-cell__title">
              <span>收款人姓名</span>
              <!----></div>
            <div class="van-cell__value">
              <div class="van-field__body">
                <input type="text" placeholder="在此处输入姓名" class="van-field__control" id="inputName">
                <!---->
                <!---->
                <!----></div>
              <!----></div>
            <!----></div>
        </div>
        <div class="submitBox">
          <button class="submit van-button van-button--primary van-button--large" id="quedingBtn">
            <span class="van-button__text">确认</span></button>
        </div>
      </div>
      <div class="copyright-content">@2016-2023 JRECMS All Rights Reserved</div></div>
    <!-- 逻辑 -->
    <div class="van-toast van-toast--default van-toast--middle" style="z-index: 2000; display: none;">
      <!---->
      <!---->
      <div class="van-loading van-loading--circular van-loading--white" style="color: white;">
        <span class="van-loading__spinner van-loading__spinner--circular">
          <svg viewBox="25 25 50 50" class="van-loading__circular">
            <circle cx="50" cy="50" r="20" fill="none"></circle>
          </svg>
        </span>
      </div>
      <div class="van-toast__text">加载中...</div></div>
    <style>.van-tabbar{ height:55px; padding-bottom: 20px; } .suspend{ width: 100%; height: 100%; position: relative; z-index: 999; background-color: rgba(0,0,0,.6); position: fixed; top: 0; left: 0; } .suspend-content{ width: 244px; height: 55px; position: fixed; top: 70%; z-index: 900; } .suspend-content-left{ width: 44px; height: 40px; background-color: rgba(0,0,0,.6); color: #fff; font-size: 8px; padding: 3px; box-sizing: border-box; border-top-left-radius:5px; border-bottom-left-radius:5px; margin-top: 10px; float: left; } .suspend-icon{ float: left; width: 10px; height: 30px; padding: 5px 0px; margin-right: 3px; font-size: 14px; } .suspend-navigation{ float: left; width: 25px; height: 30px; box-sizing: border-box; font-size: 10px; } .suspend-navigation2{ float: left; width: 25px; height: 30px; padding: 10px 0px; box-sizing: border-box; font-size: 10px; } .suspend-content-right{ width: 200px; height: 60px; background-color: #fff; float: left; border-top-left-radius:5px; border-bottom-left-radius:5px; padding: 15px 10px; box-sizing: border-box; } .suspend-content-right .van-col{ text-align: center; } .suspend-contact{ font-size: 20px; } .suspend-contact-text{ font-size: 10px; transform: scale(0.7); } .wechat-customer .wechat-bg{background:#333;opacity:0.5;width:100%;z-index:999;position:fixed;top:0;bottom:0;} .wechat-customer .wechat-cont{width:12rem;background:#fff;border-radius:5px;position:fixed;top:50%;left:50%;margin-left:-8rem;z-index:999;text-align:center;padding:2rem;margin-top:-10rem;} .wechat-customer .wechat-cont img{width:10rem;height:10rem;} .wechat-customer .wechat-cont .closewindow{position:absolute;right:1rem;top:1rem;} .wechat-customer .wechat-cont .button1{width: 12rem; height: 2rem; line-height: 2rem; border: 0px; margin: 0rem auto 0 auto; color: #999; font-size: 12px;} .wechat-customer .wechat-cont .button2{width:12.1rem;height:2rem;background:#2ba246;color:#fff;border:1px solid #2ba246;margin-top:0.5rem;} .icon-img{ border-radius: 50%; width: 50px; height: 50px; background-color: #fff; border: none; box-shadow: 0px 0px 10px 2px #e5e5e5; margin: -11px auto 0; position:relative; z-index:9999; line-height: 50px; align-items: center; display: table-cell; vertical-align: middle; } .icon-img img{ max-width: 50px; border-radius: 50%; } .van-tabbar-item__icon img{ height: auto; }</style>
    <!-- 底部内容-->
    <div id="footer">
      <!---->
      #include("footer.html")
    </div>
  </body>
</html>
<script type="text/javascript" src="#(tpath)/static/js/load.js"></script>
<script type="text/javascript">

var c=60;
var t;
var issend = false;
var returl = '';
function timedCount(){
    $('#getCode').html(c+"s");
    c=c-1;
    t=setTimeout("timedCount()",1000);
    if(c==0){
        stopCount();
    }
}

function stopCount(){
    clearTimeout(t);
    $('#getCode').html('发送验证码');
    issend = false;
    c=60;
}

function getVerify(){
    if(issend && c > 0){
        return;
    }
    var captcha = $("#captcha").val();
	if(captcha==""){
		showMessage('请输入验证码！',true);
		return false;
	}
	$.ajax({
        url: "#(base)/common/sms/sendAccount",
        type: "post",
        data: {"captcha":captcha},
        dataType: "json",
        success: function(res){
        	if(res.type=="success"){
       			
       		}else{
       			showMessage(res.msg,true);
       		}
        },
        error: function(res){
        }
    });
    issend = true;
    timedCount();
}

$("#wechatCheck").on("click",function(){
	$("#wechatRadio").addClass("van-icon-checked");
	$("#wechatRadio").removeClass("van-icon-circle");
	$("#alipayRadio").removeClass("van-icon-checked");
	$("#alipayRadio").addClass("van-icon-circle");
	$("#bankRadio").removeClass("van-icon-checked");
	$("#bankRadio").addClass("van-icon-circle");
	$("#bankDiv").hide();
});
$("#alipayCheck").on("click",function(){
	$("#alipayRadio").addClass("van-icon-checked");
	$("#alipayRadio").removeClass("van-icon-circle");
	$("#wechatRadio").removeClass("van-icon-checked");
	$("#wechatRadio").addClass("van-icon-circle");
	$("#bankRadio").removeClass("van-icon-checked");
	$("#bankRadio").addClass("van-icon-circle");
	$("#bankDiv").hide();
	
});
$("#bankCheck").on("click",function(){
	$("#bankRadio").addClass("van-icon-checked");
	$("#bankRadio").removeClass("van-icon-circle");
	$("#wechatRadio").removeClass("van-icon-checked");
	$("#wechatRadio").addClass("van-icon-circle");
	$("#alipayRadio").removeClass("van-icon-checked");
	$("#alipayRadio").addClass("van-icon-circle");
	$("#bankDiv").show();
	
});
$("#quedingBtn").on("click",function(){
	var account = $("#inputAccount").val();
	if(account==""){
		alert("请输入账号");
		return;
	} 
	var name = $("#inputName").val();
	if(name==""){
		alert("请输入姓名");
		return;
	} 
	var bank = $("#inputBank").val();
	
	var code = $("#code").val();
	if(code==""){
		alert("请输入短信验证码");
		return;
	} 
	var paymentMethod = $("#payCheck").find(".van-icon-checked").attr("val");
	$.ajax({
        url: "#(base)/member/account/save",
        type: "post",
        data: {"accountName":name,"bankName":bank,"accountType":paymentMethod,"account":account,"code":code},
        dataType: "json",
        success: function(res){
        	if(res.type=="success"){
       			location.href="#(base)/member/withdraw"
       		}else{
       			alert(res.msg);
       		}
        },
        error: function(res){
        }
    });
});
</script>